/**
 * Created with IntelliJ IDEA.
 * Description:   单向链表
 * User:岁亮亮
 * Date:2024-01-21
 * TIME:9:27
 */
public class Test {
    public static  MyLinkedList.Linknode mydoubleLinkedList2(MyLinkedList.Linknode linknode1,
                                                            MyLinkedList.Linknode linknode2){
        MyLinkedList myLinkedList1=new MyLinkedList();
        MyLinkedList myLinkedList2=new MyLinkedList();
        linknode1=myLinkedList1.head;
        linknode2=myLinkedList1.head;
        myLinkedList1.size();
    }
    public static  MyLinkedList.Linknode mydoubleLinkedList(MyLinkedList.Linknode linknode1,
                                                    MyLinkedList.Linknode linknode2){
        MyLinkedList.Linknode newh=new MyLinkedList.Linknode(0);
        MyLinkedList.Linknode tmph=newh;
        while (linknode1!=null&&linknode2 !=null){
            if(linknode1.data<linknode2.data){
                tmph.next=linknode1;
                linknode1=linknode1 .next;
            }
            else {
                tmph.next=linknode2;
                linknode2=linknode2 .next;
            }
            tmph=tmph.next;
        }
       if(linknode1!=null){
            tmph.next=linknode1;
        }
       if(linknode2 !=null ){
            tmph.next=linknode2;
        }
        return newh.next;
    }

    public static void main(String[] args) {
        MyLinkedList myLinkedList=new MyLinkedList();
        myLinkedList.addLast(12);
        myLinkedList.addLast(23);
        myLinkedList.addLast(23);
        myLinkedList.addLast(12);
        System.out.println("是否回文 true/false  "+myLinkedList.huiwen());
    }
    public static void main2(String[] args) {
        MyLinkedList myLinkedList=new MyLinkedList();
        myLinkedList.addLast(12);
        myLinkedList.addLast(23);
        myLinkedList.addLast(34);
        myLinkedList.addLast(56);
        myLinkedList.addLast(278);
        myLinkedList.display();

        MyLinkedList myLinkedList2=new MyLinkedList();
        myLinkedList2.addLast(1);
        myLinkedList2.addLast(23);
        myLinkedList2.addLast(35);
        myLinkedList2.addLast(46);
        myLinkedList2.addLast(178);
        myLinkedList2 .display();
        MyLinkedList.Linknode ret=mydoubleLinkedList(myLinkedList.head,myLinkedList2.head );
        myLinkedList.display(ret);


    }
    public static void main1(String[] args) {
        MyLinkedList myLinkedList=new MyLinkedList();
        //myLinkedList.creatList();
        /*myLinkedList.addFirst(12);
        myLinkedList.addFirst(23);
        myLinkedList.addFirst(34);
        myLinkedList.addFirst(45);*/
        myLinkedList.addLast(56);
        myLinkedList.addLast(45);
        myLinkedList.addLast(34);
        myLinkedList.addLast(56);
        myLinkedList.addLast(78);
        myLinkedList.display();
       // myLinkedList.reverselist();
       // MyLinkedList.Linknode ret=myLinkedList.findmiddlenode() ;
        //myLinkedList.display(ret);
        MyLinkedList.Linknode ret=myLinkedList.show_k_Node(6) ;
        System.out.println(ret);
        System.out.println(myLinkedList.size());
    }


}
